#include "requestbufferdatamessage.h"

RequestBufferDataMessage::RequestBufferDataMessage(const UserId& userId)
{
    m_messageType = MessageType::RequestDataBuffer;
    m_userId = userId;
}

RequestBufferDataMessage::RequestBufferDataMessage(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_userId = jsonObj[JsonKey::USER_ID].toString();
}

QJsonObject RequestBufferDataMessage::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::USER_ID] = m_userId;
    return jsonObj;
}

UserId RequestBufferDataMessage::getUserId() const
{
    return m_userId;
}
